﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.SM
{
    /// <summary>
    /// 生命_意外伤害保险_主_B款
    /// </summary>
    class Class14
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("意外残疾"))
            {
                ppa.SchemePeriodActing.InsurantStates.Add("身故");

                double f = ppa.GetDutyTotalValue("意外残疾");

                da.Value = ppa.Amount - f;

                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("航空意外残疾"))
            {

                ppa.SchemePeriodActing.InsurantStates.Add("意外残疾");

                IDutyActing da2 = ppa.DutyActings.FirstOrDefault(p => p.Duty.Name == "意外残疾保险");

                if (da2 != null)
                {
                    da2.Duty.Action(ppa, da2);

                    da.Value = da2.Value *2 ;

                }

            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ppa"></param>
        /// <param name="da"></param>
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("航空意外身故"))
            {
                ppa.SchemePeriodActing.InsurantStates.Add("意外身故");

                double f = ppa.GetDutyTotalValue("意外残疾");

                da.Value = 2 * (ppa.Amount - f);

                ppa.IsCurrentFinish = true;
            }
        }

    }
}
